
<form id="addUserForm" action="" method="get">
        <div class="formLabel">First Name:</div>
        <div class="formField"><input type="text" class="input" id="userFirstName" maxlength="38" /></div>
        <div class="clear"></div>

        <div class="formLabel">Last Name:</div>
        <div class="formField"><input type="text" class="input" id="userLastName" maxlength="38" /></div>
        <div class="clear"></div>
        
	<div class="formLabel">Permissions:</div>
        <div class="formField">
        <input type="radio" name="userAccessLevel" id="guestAccessLevel" value="0" /><label for="guestAccessLevel"> Guest</label><br />
        <input type="radio" name="userAccessLevel" id="csrAccessLevel" value="1" /><label for="csrAccessLevel"> CSR</label><br />
        <input type="radio" name="userAccessLevel" id="techAccessLevel" value="2" /><label for="techAccessLevel"> Tech</label><br />
        <input type="radio" name="userAccessLevel" id="managerAccessLevel" value="3" /><label for="managerAccessLevel"> Manager</label><br />
        <input type="radio" name="userAccessLevel" id="adminAccessLevel" value="5" /><label for="adminAccessLevel"> Admin</label></div>
        <div class="clear"></div>

        <div class="formLabel">Username:</div>
        <div class="formField"><input type="text" class="input" id="userUsername" maxlength="38" /></div>
        <div class="clear"></div>

        <div class="formLabel">E-mail:</div>
        <div class="formField"><input type="text" class="input" id="userEmail" maxlength="38" /></div>
        <div class="clear"></div>

        <div class="formLabel">Password:</div>
        <div class="formField"><input type="password" class="input" id="userPassword1" value="" maxlength="38" /></div>
        <div class="clear"></div>

        <div class="formLabel">Re-Type Password:</div>
        <div class="formField"><input type="password" class="input" id="userPassword2" value="" maxlength="38" /><div class="lite">password strength (future...)</div></div>
        <div class="clear"></div>

        <div class="formLabel"></div>
        <div class="formField"><input type="button" class="submit" id="userAddSubmit" value="Add User" /><input type="reset" class="submit" value="Reset Form" /></div>
        <div class="clear"></div>

	<div id="userSubmitError" style="display: none">Passwords do not match</div>
</form>


<script type="text/javascript">

        $('userAddSubmit').addEvent('click', function(e){
		if ($('guestAccessLevel').checked){
			var access_level = "0";
		}
		else if ($('csrAccessLevel').checked){
			var access_level = "1";

		}
		else if ($('techAccessLevel').checked){
			var access_level = "2";

		}
		else if ($('managerAccessLevel').checked){
			var access_level = "3";

		}
		else if ($('adminAccessLevel').checked){
			var access_level = "5";

		}
                var url = 'pages/query.php?';
                url=url+'firstName='+$('userFirstName').value;
                url=url+'&lastName='+$('userLastName').value;
                url=url+'&username='+$('userUsername').value;
		url=url+'&email='+$('userEmail').value;
		url=url+'&access_level='+access_level;
                url=url+'&cmd=addUser';
		if ($('userPassword1').value == $('userPassword2').value) {
                        url=url+'&password='+$('userPassword1').value;
                	url=url+'&nocache='+Math.random();
                	MochaUI.updateContent({
                        	'element': $('panel1'),
                        	'loadMethod': 'xhr',
                        	'url': url,
                        	'title': 'Results',
                        	'padding': { top: 8, right: 8, bottom: 8, left: 8 }
                	});
			MochaUI.notification('User Added Successfully');
                }
		else {
			MochaUI.notification('Passwords do not match');
			//$('userSubmitError').setStyle('display','block');
			//break;
		}
		//alert(url);
		/*
		MochaUI.notification('User Added Successfully');
                /*MochaUI.updateContent({
                        'element': $('addUser'),
                        'loadMethod': 'xhr',
                        'url': url,
                        'title': 'Results',
                        'padding': { top: 8, right: 8, bottom: 8, left: 8 }
                });*/
        });

</script>

